package cn.gson.springboot.model.mapper;

import java.sql.Date;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.alibaba.fastjson.JSONArray;

@Mapper
public interface DrugRoomMappers {

		//药房请领查询药品基本信息
		public JSONArray selectDrugRoomInStorage(@Param("drugname")String drugname,
																							   @Param("drug_number")Integer drug_number,
																							   @Param("type_name")String type_name);
		
	    //药房入库查询药品基本信息
		public JSONArray  selectDrugsInStorage(@Param("drugapply_people")String drugapply_people);
		
	    //药房入库查看详情
		public JSONArray selectDrugsInStorageDetails(@Param("drugapply_id")Integer drugapply_id,@Param("outbound_zt")Integer outbound_zt);
		
		// 确认收货新增门诊库存
		public  void addoutpatientStorage(@Param("drug_number")Integer drug_number,
																		  @Param("outpatient_pici")Integer outpatient_pici,
																		  @Param("outpatient_storage_amount")Integer outpatient_storage_amount,
																		  @Param("outpatient_storage_startdate")Date outpatient_storage_startdate,
																		  @Param("outpatient_storage_usedate")Date outpatient_storage_usedate);
		   
	     //确认收货新增住院库存
		public  void addinhospitalStorage(@Param("drug_number")Integer drug_number,
																		  @Param("inhospital__pici")Integer inhospital__pici,
																		  @Param("inhospital__storage_amount")Integer inhospital__storage_amount,
																		  @Param("inhospital_storage_startdate")Date inhospital_storage_startdate,
																		  @Param("inhospital_storage_usedate")Date inhospital_storage_usedate);
	
		//收货之后修改请领状态 
		public  void  updateDrugApply_state(@Param("drugapply_state")Integer drugapply_state,
																				@Param("drugapply_type")Integer drugapply_type,
				  																@Param("drugapply_id")Integer drugapply_id);
		      
		  
		//收货之后修改出库状态
	   public  void  updateOutBound_state(@Param("outbound_state")Integer outbound_state,
																			  @Param("outbound_number")Integer outbound_number);
		
	   //门诊入库选择判断
	   public JSONArray if_addDrugsInStorage(@Param("drug_number")Integer drug_number,
		  																			  @Param("out_details_pici")Integer out_details_pici);
	   
	  //住院入库选择判断
	   public JSONArray  if_Inhospital_addDrugsInStorage(@Param("drug_number")Integer drug_number,
			   																								@Param("out_details_pici")Integer out_details_pici);
	
	   
	   //修改门诊库存
	   public  void updateOutpatient_storage_amount(@Param("outpatient_storage_amount")Integer outpatient_storage_amount,
				  																					 @Param("drug_number")Integer drug_number);
	         
	   
	   //修改住院库存
	   public  void updateInhospital_storage_amount(@Param("inhospital__storage_amount")Integer inhospital_storage_amount,
			   																					   @Param("drug_number")Integer drug_number);
	          
	     
	   //门诊库存查询
	   public JSONArray  select_OutPatientStorage_record(@Param("drug_name")String drug_name,@Param("days")Integer days,
			   											@Param("drug_number")Integer drug_number,@Param("drug_pici")Integer drug_pici);
	   
	   //住院库存查询
	   public JSONArray select_InhospitalStorage_record(@Param("drug_name")String drug_name,@Param("days")Integer days,
			   																							 @Param("drug_number")Integer drug_number,@Param("drug_pici")Integer drug_pici);
			
	   // 门诊发药查询人员
	   public JSONArray select_OutPatientStorage_people(@Param("clinic_name")String clinic_name);
		
	  //门诊发药根据人员查询详情
	   public JSONArray select_OutPatientStorage_peopledetails(@Param("cliniccard_id")String cliniccard_id);
	   
	   //门诊根据药品编号查询药品所有批次
	   public JSONArray selectPiciBydrugNumber(@Param("drug_id")Integer drug_id,@Param("outpatient_pici")Integer outpatient_pici);
	   
	   //根据药品编号与批次修改门诊库存 
	   public void updateOutpatient_Drugamount(@Param("outpatient_storage_amount")Integer outpatient_storage_amount,
												  @Param("drug_number")Integer drug_number,
												  @Param("outpatient_pici")Integer outpatient_pici); 
	  
	   //门诊发药记录人
	   public JSONArray  select_publicDrugPeople (@Param("clinic_name")String clinic_name);
	
	   //门诊发药记录
	   public JSONArray select_publicDrug(@Param("publicdurg_id")Integer publicdurg_id); 
	   
	   //住院发药记录
	   public JSONArray  select_publicDrug_Inhospital(@Param("publicdurg_type")Integer publicdurg_type,
																									@Param("docdetails_type")Integer docdetails_type,
																									@Param("publicdurg_id")Integer  publicdurg_id);
	   
	  //住院发药记录 查看详情
	   public JSONArray select_publicDrug_InhospitalDetails(@Param("publicdurg_type")Integer publicdurg_type,
			   																									@Param("publicdurg_id")Integer  publicdurg_id,
			   																									@Param("docdetails_type")Integer docdetails_type);
	
	   //住院根据药品编号查询药品所有批次 
	   public JSONArray selectInHosPiciBydrugNumber(@Param("drug_id")Integer drug_id,
																									  @Param("inhospital__pici")Integer  inhospital__pici);
	   
	  //根据药品编号与批次修改住院库存
	  public void updateInHospital_Drugamount(@Param("inhospital__storage_amount")Integer inhospital__storage_amount,
			  																			  @Param("drug_number")Integer drug_number,
			  																			  @Param("outpatient_pici")Integer  outpatient_pici);
	      
	  //根据医嘱详情查询出药品id
	  public JSONArray selectdrugNumberByDocdetailsid(@Param("docdetails_id")Integer docdetails_id);
	 
	  //根据发药主表id修改
	  public void updatePublicDrugBypublicDrug_id(@Param("publicdurg_peope")String publicdurg_peope,
				  																			    @Param("publicdurg_shijishuliang")Integer publicdurg_shijishuliang,
				  																			    @Param("publicdurg_id")Integer publicdurg_id);
	       
	 
	  // 根据发药详情id修改
	  public void  updatePublicDrugBypublicDrugDetails_id(  @Param("pd_details_pici")Integer  pd_details_pici,
																											    @Param("pd_details_sjcount")Integer pd_details_sjcount,
																											    @Param("pd_details_id")Integer pd_details_id);
	 // 门诊药品出库数量
	 public JSONArray select_outpatient_outAmount(@Param("drug_id")Integer drug_id,@Param("publicdurg_type")Integer publicdurg_type,@Param("pd_details_pici")Integer pd_details_pici);
	 
	 // 门诊盘点药品统计入库数量
	 public JSONArray select_outpatient_InAmount(@Param("drug_id")Integer drug_id,@Param("drugapply_type")Integer drugapply_type,@Param("out_details_pici")Integer out_details_pici);
	 
	 //修改住院小药房库存
	 public void updateInhospital_samllstorage_amount(@Param("inhosp_samallstorage")Integer inhosp_samallstorage,
													@Param("drug_number")Integer  drug_number,
													@Param("inhospital__pici")Integer inhospital__pici);
	
	//执行医嘱时，修改住院小库存的数量
	 public void updateHospsamllstorage(@Param("inhosp_samallstorage")Integer inhosp_samallstorage,
				@Param("drug_number")Integer  drug_number,
				@Param("inhospital__pici")Integer inhospital__pici);
	
	
	 //查询住院药房库存
	 public JSONArray selecthospdrugkucun(@Param("drug_name")String  drugname,
			 							@Param("drugtype")String drugtype);
	 
	 
	 //开立医嘱时，修改药房库存
	 public void updateInhospitalkucun(@Param("kucun")Integer kucun,
				@Param("drugno")Integer  drugno,
				@Param("pici")Integer pici);
	
	 // 门诊看诊药品查询
	public JSONArray select_OutPatientDrug_record(@Param("drug_name")String drug_name);
	
	//根据药品编号与批次查询库存主键id
	public JSONArray select_inventoryDrug_number(@Param("drug_number")Integer drug_number,@Param("inventory_details_batch")Integer inventory_details_batch);
	
	//查询退药信息
	public JSONArray  select_returnDrug_record(@Param("return_goods_id")Integer return_goods_id);
	
	//查询退药详情信息
	public JSONArray  select_returnDrug_recordDetails(@Param("return_goods_id")Integer return_goods_id);
	
	//盘点门诊库存查询
	public JSONArray select_CheckOutPatientStorage_record(@Param("drug_number")Integer drug_number,@Param("drug_pici")Integer drug_pici);
	
	//盘点住院库存查询 
	public JSONArray select_CheckInhospitalStorage_record(@Param("drug_number")Integer drug_number,@Param("drug_pici")Integer drug_pici);
	
	//门诊查询亏损出库记录
	public JSONArray  select_oupatient_badamount(@Param("publicdurg_type")Integer publicdurg_type,
																		   @Param("drug_number")Integer drug_number,
																		   @Param("pd_details_pici")Integer pd_details_pici);
	
	// 门诊1住院2查询亏损入库库记录
	public JSONArray  select_oupatient_bad_in_amount(@Param("drugapply_type")Integer drugapply_type,
																				@Param("drug_number")Integer drug_number,
																				@Param("out_details_pici")Integer out_details_pici);
	//修改退药状态---5已退药
	public void  update_return_state(@Param("returngoid")Integer  returngoid);
 	

	//统计退药数量 
	public JSONArray return_good_amountBydrug_number_pici(@Param("return_goods_type")String return_goods_type,
														  @Param("drug_number")Integer drug_number,
														  @Param("return_details_pici")Integer return_details_pici);
	
	//销毁数量 
	public JSONArray destroy_good_amountBydrug_number_pici(@Param("destroy_state")Integer destroy_state,
														   @Param("drug_number")Integer drug_number,
														   @Param("destroy_pici")Integer destroy_pici);
	 
   //盘点修改库存根据药品编号与批次修改门诊库存
   public void updateOutpatient_DrugamountBycheck(@Param("outpatient_storage_amount")Integer outpatient_storage_amount,
			  									  @Param("drug_number")Integer drug_number,
			  									  @Param("outpatient_pici")Integer outpatient_pici); 
	   		  
   //查看盘点
   public JSONArray select_check();
   
   //盘点查看详情
   public JSONArray select_checkDetails(@Param("drugchek_id")Integer drugchek_id);

  //根据药品id查询库存id
   public JSONArray select_InventroyNumber(@Param("drug_number")Integer drug_number);
}
